package com.sherlockHolmes.init.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sherlockHolmes.init.base.template.MessageTemplate;
import com.sherlockHolmes.init.entity.dao.Community;
import com.sherlockHolmes.init.entity.dao.Message;
import com.sherlockHolmes.init.mapper.CommunityMapper;
import com.sherlockHolmes.init.service.CommunityService;
import com.sherlockHolmes.init.service.MessageService;
import com.sherlockHolmes.init.mapper.MessageMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
* @author 四月一日 君寻
* &#064;description  针对表【message(消息表)】的数据库操作Service实现
* &#064;createDate  2024-03-28 10:37:10
 */
@Service
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message>
    implements MessageService{
    @Resource
    private MessageMapper messageMapper;
    @Resource
    private CommunityMapper communityMapper;

    @Override
    public void sendMessage(Integer addressee, Integer userId,String type, String messageInfo) {
            Message message = new Message();
            message.setType(type);//发送类型
            message.setUserId(userId);
            message.setMessage(messageInfo);
            message.setAddressee(addressee);
            message.setCreateTime(new Date());
            messageMapper.insert(message);
    }

}




